<h1>Pool Administration</h1>
<% form_for 'pool', @pool, :url => {:controller => 'admin', :action => 'pool', :id => @pool.id} do |f| -%>
<table border="0" width="100%">
<tr><td>Number of submitted entries</td><td><%=@pool.user_entries.size - @pool.pending_entries.size%></td></tr>
<tr><td>Number of pending entries</td><td><%=@pool.pending_entries.size%></td></tr>
<tr>
<td><%=f.label 'name'%></td>
<td><%=f.text_field 'name', :size => 40, :maxlength => 128%></td>
</tr>
<tr>
<td><%=f.label 'starts_at'%></td>
<td><%=f.datetime_select 'starts_at'%></td>
</tr>
<tr>
<td><%=f.label 'active'%></td>
<td><%=f.check_box 'active'%></td>
</tr>
<tr>
<td><%=f.label 'fee'%></td>
<td>$<%=f.text_field 'fee', :size => 5, :maxlength => 3%></td>
</tr>
<tr>
<td><%=f.label 'scoring_strategy'%></td>
<td>
<% @available_scoring_strategies.each do |s| -%>
<%=f.radio_button 'scoring_strategy', s.class.name %> <em><%= s.name %></em>: <%= s.description%>
<br/>
<% end -%>
</td>
</tr>
<tr>
<td>
Payouts
<a class="info" href="#">?
<span>
<small>
Payouts have a rank, amount and kind.  The rank is either a number or
the letter L.  Rank 1 defines the payout for 1st place, rank 2 for
2nd place and so on.  Rank L defines the payout for the last place
entry and is optional.  The amount of the payout is a number.  Its
meaning depends on the kind of the payout.  If the kind is '%', then
the amount is a percentage of the total entry fees collected.  If
the kind is '$', then the amount is a fixed dollar amount.  This lets
you have payouts for the pool that give the last place entry the
entry fee back.
</small>
</span>
</a>
</td>
<td>
<table border="0">
<tr><td><b>Rank</b></td><td><b>Amount</b></td><td><b>Kind</b></td><td><b>Delete?</b></td></tr>
<% @pool.payouts.each_with_index do |po, idx| -%>
<% f.fields_for 'payouts', po do |payout_fields| -%>
<tr>
<td><%= payout_fields.text_field 'rank', :size => 2, :maxlength => 5, :index => idx%></td>
<td><%= payout_fields.text_field 'payout', :size => 5, :maxlength => 10, :index => idx%></td>
<td><%= payout_fields.select 'kind', ['%', '$'], {}, :index => idx%></td>
<td><%= payout_fields.check_box :_delete, :index => idx %></td>
</tr>
<% end -%>
<% end -%>
</table>
</td>
</tr>
</table>
<%= submit_tag 'Save'%>
<% end -%>
